package com.chinacoal.hr.levelapi.client;

import com.chinacoal.hr.levelapi.client.fallback.BizTravelClientFallback;
import com.chinacoal.hr.levelapi.client.response.Result;
import com.chinacoal.hr.levelapi.entity.BizTravel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by jinyabin on 2020/10/29.
 */
@Api(tags = {"出差申请单"})
@FeignClient(name = "ccip-hr-attendance",configuration = FeignAutoConfiguration.class,fallback = BizTravelClientFallback.class)
public interface BizTravelClient {



    /**
     * 查询出差申请单列表
     *
     * @param page           :
     * @param limit          :
     * @param ouId           :
     * @param bizTravelCode  :
     * @param businessStatus :
     * @param queryRange     :查询范围（all、dept、person）
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/19 2019/11/19
     */
    @ResponseBody
    @GetMapping("/travels")
    @ApiOperation(value = "查询出差申请单列表")
    public Result list(@ApiParam("当前页数") long page,
                       @ApiParam("每页条数") long limit,
                       @ApiParam("组织机构") String ouId,
                       @ApiParam("部门编码") String deptCode,
                       @ApiParam("部门名称") String deptName,
                       @ApiParam("员工姓名") String empName,
                       @ApiParam("员工编码") String empCode,
                       @ApiParam("单据编号") String bizTravelCode,
                       @ApiParam("审批状态") String businessStatus,
                       @ApiParam("查询范围") String queryRange) ;




    /**
     * 查询出差单的随同人员
     *
     * @param travelId :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/28 2019/11/28
     */
    @ResponseBody
    @GetMapping("/travel/{travelId}/emps")
    @ApiOperation(value = "查询出差随同人员")
    public Result listEmp(
            @PathVariable String travelId) ;



    /**
     * 新增出差申请单
     *
     * @param record :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/19 2019/11/19
     */
    @PostMapping("/travel")
    @ApiOperation(value = "新增出差申请单")
    public Result add(@RequestBody BizTravel record);



    /**
     * 编辑出差申请单
     *
     * @param bizTravelId :
     * @param record      :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/19 2019/11/19
     */
    @PutMapping("/travel/{bizTravelId}")
    @ApiOperation(value = "编辑出差申请单")
    public Result update(@PathVariable String bizTravelId,
                         @RequestBody BizTravel record) ;



    /**
     * 删除出差申请单
     *
     * @param bizTravelId :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/19 2019/11/19
     */
    @DeleteMapping("/travel/{bizTravelId}")
    @ApiOperation(value = "删除出差申请单")
    public Result delete(@PathVariable String bizTravelId) ;



    /**
     * 提交出差申请单
     *
     * @param bizTravelId :
     * @param record      :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/11/19 2019/11/19
     */
    @PutMapping("/travel/{bizTravelId}/submit")
    @ApiOperation(value = "提交出差申请单")
    public Result submit(@PathVariable String bizTravelId,
                         @RequestBody BizTravel record) ;



    /**
     * 撤回出差申请单
     *
     * @param bizTravelId :
     * @param record      :
     * @return : com.chinacoal.hr.levelimpl.response.Result
     * @author : YunTao.Li
     * @date : 2019/12/12 2019/12/12
     */
    @PutMapping("/travel/{bizTravelId}/drawback")
    @ApiOperation(value = "撤回出差申请单")
    public Result drawback(@PathVariable String bizTravelId,
                           @RequestBody BizTravel record) ;




    /**
     * 变更出差申请单
     *
     * @param bizTravelId :
     * @param record      :
     * @return : com.chinacoal.hr.levelapi.response.Result
     * @author : YunTao.Li
     * @date : 2019/12/4 2019/12/4
     */
    @PutMapping("/travel/change/{bizTravelId}")
    @ApiOperation(value = "变更出差申请单")
    public Result change(@PathVariable String bizTravelId,
                         @RequestBody BizTravel record) ;

}
